# _*_ coding: utf-8 _*_

import pygame
from pygame import locals
import sys

pygame.init()
print(pygame.display.list_modes())

bgimg="display.jpg"
pygame.display.set_caption("pygame的窗口显示")
window=pygame.display.set_mode((640, 480),locals.HWSURFACE|locals.RESIZABLE,32)
# bgsurfance=pygame.Surface((640,480))
# background=pygame.image.load(bgimg).convert(bgsurfance)
background=pygame.image.load(bgimg).convert()

fullscreen=False

while True:
    event=pygame.event.poll()
    if event.type==locals.QUIT:
        sys.exit()
    if event.type==locals.VIDEORESIZE:
        size=event.size
        window=pygame.display.set_mode(size,locals.VIDEORESIZE,32)
        pygame.display.set_caption("变换到尺寸："+str(size))
    if event.type== locals.KEYUP:
        if event.key == locals.K_F1:
            if fullscreen:
                window=pygame.display.set_mode((640, 480),locals.FULLSCREEN,32)
                fullscreen=False
            else:
                window=pygame.display.set_mode((640, 480),0,32)
                fullscreen=True
    window.blit(background,(0,0))
    pygame.display.update()
    # pygame.display.flip()

pygame.quit()
